package io.qar.mq.consumer;

import io.qar.mq.entity.User;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

/**
 * @program: qar-cloud
 * @description:
 * @author: yyyyjinying
 * @create: 2023-10-10 16:11
 **/
@Service
@RocketMQMessageListener(consumerGroup = "demoGroup",
        topic = "demoTopic",
//          消息模式： 广播模式和集群模式
//        messageModel = MessageModel.CLUSTERING
//        消费模式： 顺序消费
        consumeMode = ConsumeMode.ORDERLY)
public class DemoConsumerService implements RocketMQListener<User> {

    @Override
    public void onMessage(User s) {
        System.out.println(s);
    }
}
